import { createRouter, createWebHashHistory } from "vue-router";
import Map from "../pages/HelloWorld.vue";
import MBInfo from "../pages/table.vue";
import MonthReport from "../pages/MonthReport.vue";
import MonthReportEdit from "../pages/MonthReportEdit.vue";
import PressureTestKit from "../pages/PressureTestKit.vue";
import Construction from "../pages/Construction.vue";
import EmpInfo from "../pages/EmpInfo.vue";

const routes = [
  {
    path: "/",
    redirect: "/Map",
  },
  {
    path: "/Map",
    name: "Map",
    component: Map,
    meta: {
      title: "地图",
    },
  },
  {
    path: "/Construction",
    name: "Construction",
    component: Construction,
    meta: {
      title: "施工可视化",
    },
  },
  {
    path: "/MBInfo",
    name: "MBInfo",
    component: MBInfo,
    meta: {
      title: "地图",
    },
  },
  {
    path: "/MonthReport",
    name: "MonthReport",
    component: MonthReport,
    meta: {
      title: "月报",
    },
  },
  {
    path: "/MonthReportEdit",
    name: "MonthReportEdit",
    component: MonthReportEdit,
    meta: {
      title: "月报填写",
    },
  },
  {
    path: "/PressureTestKit",
    name: "PressureTestKit",
    component: PressureTestKit,
    meta: {
      title: "试压包",
    },
  },
  {
    path: "/EmpInfo",
    name: "EmpInfo",
    component: EmpInfo,
    meta: {
      title: "采购人员信息",
    },
  },
];

const router = createRouter({
  history: createWebHashHistory(), //hash

  routes,
});

router.beforeEach((to, from, next) => {
  next();
});

export default router;
